package com.neuedu.dao.impl;

import java.util.List;
import java.util.Map;

import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.neuedu.dao.SalesDao;
import com.neuedu.dao.SalesReturnDao;
import com.neuedu.model.SalesReturn;

//把dao接口实现类，交给spring进行管理
@Repository
public class SalesReturnDaoImpl implements SalesReturnDao {

	//代码层级的整合spring+mybatis
	@Autowired
	private SqlSessionTemplate sqlSessionTemplate;
	
	public void setSqlSessionTemplate(SqlSessionTemplate sqlSessionTemplate) {
		this.sqlSessionTemplate = sqlSessionTemplate;
	}

	@Override
	public int countSalesReturn() {
		// TODO Auto-generated method stub
		return sqlSessionTemplate.getMapper(SalesReturnDao.class).countSalesReturn();
	}

	@Override
	public List<SalesReturn> findAll(Map<String, Object> map) {
		// TODO Auto-generated method stub
		return sqlSessionTemplate.getMapper(SalesReturnDao.class).findAll(map);
	}

	@Override
	public int addSalesReturn(SalesReturn c) {
		// TODO Auto-generated method stub
		return sqlSessionTemplate.getMapper(SalesReturnDao.class).addSalesReturn(c);
	}

	@Override
	public int updateSalesReturn(SalesReturn c) {
		// TODO Auto-generated method stub
		return sqlSessionTemplate.getMapper(SalesReturnDao.class).updateSalesReturn(c);
	}

	@Override
	public int deleteSalesReturn(int id) {
		// TODO Auto-generated method stub
		return sqlSessionTemplate.getMapper(SalesReturnDao.class).deleteSalesReturn(id);
	}

}
